package api

import (
	"net/http"
	"go-web/web"
)

const (
	GET string = "GET"
	POST string = "POST"
	DELETE string = "DELETE"
	PUT string = "PUT"

	ID string = "id"
)

type Api struct {
	web.WebHandler
	Cname string
}

type ApiResponse struct {
	Status int `json:"status"`
	Msg string `json:"msg"`
	Datas interface{} `json:"datas"`
}

var SUCCESS = &ApiResponse{Status : 2000,Msg : "success"}
var ERROR  =  &ApiResponse{Status : 5000}
var PARAM_ERROR = &ApiResponse{Status : 4000, Msg:"请求的参数不正确"}
var PARAM_CONV_ERROR = &ApiResponse{Status : 4001, Msg:"请求的参数不合规"}

func buildSuccess() *ApiResponse  {
	return &ApiResponse{Status:2000, Msg:"成功"}
}

/**
共享的对方访问的检查接口服务
 */
func CheckHandler() web.WebHandler {
	return func(write http.ResponseWriter, request *http.Request) {
		write.Write([]byte("consulCheck"))
	}
}